home *** CD-ROM | disk | FTP | other *** search
/ Clickx 47 / Clickx 47.iso / assets / software / Miro_Installer.exe / xulrunner / chrome / toolkit.jar / content / mozapps / extensions / update.xml < prev    next >
Encoding:
Extensible Markup Language  |  2005-09-29  |  7.5 KB  |  189 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!DOCTYPE bindings SYSTEM "chrome://mozapps/locale/extensions/update.dtd">
  4.  
  5. <bindings id="updatesBindings"
  6.           xmlns="http://www.mozilla.org/xbl"
  7.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  8.           xmlns:xbl="http://www.mozilla.org/xbl">
  9.  
  10.   <binding id="updateCategorySet" extends="chrome://global/content/bindings/radio.xml#radiogroup">
  11.     <implementation>
  12.       <method name="computeSizes">
  13.         <body>
  14.         <![CDATA[
  15.           var kids = this._getRadioChildren();
  16.           for (var i = 0; i < kids.length; ++i)
  17.             kids[i].expandedHeight = kids[i]._content.boxObject.height;
  18.           this.removeAttribute("_uninitialized");
  19.         ]]>
  20.         </body>
  21.       </method>
  22.       <field name="lastSelectedItem">null</field>
  23.     </implementation>
  24.   </binding>
  25.   
  26.   <binding id="updateCategory" extends="chrome://global/content/bindings/radio.xml#radio">
  27.     <resources>
  28.       <stylesheet src="chrome://global/skin/radio.css"/>
  29.       <stylesheet src="chrome://mozapps/skin/update/update.css"/>
  30.     </resources>
  31.     <content>
  32.       <xul:hbox class="updateCategoryBox" xbl:inherits="selected,checked,disabled">
  33.         <xul:hbox class="radio-check-box1" xbl:inherits="selected,checked,disabled">
  34.           <xul:hbox class="radio-check-box2" flex="1">
  35.             <xul:image class="radio-check" xbl:inherits="selected,checked,disabled"/>
  36.           </xul:hbox>
  37.         </xul:hbox>
  38.         <xul:image class="updateCategoryIcon" xbl:inherits="src"/>
  39.         <xul:label class="updateCategoryLabel" xbl:inherits="xbl:text=label,accesskey,crop,selected" flex="1"/>
  40.       </xul:hbox>
  41.       <xul:vbox flex="1" class="updateCategoryContent">
  42.         <children/>
  43.       </xul:vbox>
  44.     </content>  
  45.     <implementation implements="nsITimerCallback">
  46.       <property name="expandedHeight" 
  47.                 onget="return this.getAttribute('expandedHeight');"
  48.                 onset="this.setAttribute('expandedHeight', val); return val;"/>
  49.       
  50.       <method name="notify">
  51.         <parameter name="aTimer"/>
  52.         <body>
  53.         <![CDATA[
  54.             var newHeight;
  55.             if (this._destinationSize == 0) {
  56.               if (this._content.boxObject.height > 0) {
  57.                 newHeight = this._content.boxObject.height - this._animateIncrement;
  58.                 newHeight = newHeight < 0 ? 0 : newHeight;
  59.                 this._content.style.height = newHeight + "px";
  60.                 this._timer.initWithCallback(this, this._animateDelay, 
  61.                                              Components.interfaces.nsITimer.TYPE_ONE_SHOT);
  62.               }
  63.               else {
  64.                 this._timer.cancel();
  65.                 this._content.style.visibility = "collapse";
  66.               }
  67.             }
  68.             else {
  69.               if (this._content.boxObject.height <= this._destinationSize) {
  70.                 newHeight = this._content.boxObject.height + this._animateIncrement;
  71.                 newHeight = newHeight > this.expandedHeight ? this.expandedHeight : newHeight;
  72.                 this._content.style.height = newHeight + "px";
  73.                 this._timer.initWithCallback(this, this._animateDelay, 
  74.                                              Components.interfaces.nsITimer.TYPE_ONE_SHOT);
  75.               }
  76.               else
  77.                 this._timer.cancel();
  78.             }
  79.         ]]>
  80.         </body>
  81.       </method>
  82.       
  83.       <method name="_setUpTimer">
  84.         <parameter name="aSelected"/>
  85.         <body>
  86.         <![CDATA[
  87.           if (!this._timer) 
  88.             this._timer = Components.classes["@mozilla.org/timer;1"]
  89.                                     .createInstance(Components.interfaces.nsITimer);
  90.           else
  91.             this._timer.cancel();
  92.           
  93.           this._content.style.visibility = "visible";
  94.  
  95.           this._destinationSize = aSelected ? this.expandedHeight : 0;
  96.           this._timer.initWithCallback(this, this._animateDelay, 
  97.                                        Components.interfaces.nsITimer.TYPE_ONE_SHOT);
  98.         ]]>
  99.         </body>
  100.       </method>
  101.       
  102.       <field name="_content">
  103.         document.getAnonymousElementByAttribute(this, "class", "updateCategoryContent");
  104.       </field>
  105.       <field name="_timer">null</field>
  106.       <field name="_animateDelay">50</field>
  107.       <field name="_animateIncrement">25</field>
  108.       <field name="_destinationSize">0</field>
  109.     </implementation>
  110.     <handlers>
  111.       <handler event="RadioStateChange">
  112.       <![CDATA[
  113.       /*
  114.         this._content.style.height = "0px";
  115.         
  116.         if (this.radioGroup.lastSelectedItem)
  117.           this.radioGroup.lastSelectedItem._setUpTimer(false);
  118.         this.radioGroup.lastSelectedItem = this;
  119.         
  120.         this._setUpTimer(true);*/
  121.       ]]>
  122.       </handler>
  123.     </handlers>
  124.   </binding>
  125.  
  126.   <binding id="updateItem" extends="chrome://global/content/bindings/checkbox.xml#checkbox">
  127.     <content>
  128.       <xul:image class="checkbox-check" xbl:inherits="checked,disabled"/>
  129.       <xul:hbox class="checkbox-label-box" flex="1">
  130.         <xul:label class="checkbox-label foundLabel" xbl:inherits="xbl:text=label,accesskey" flex="1"/>
  131.         <xul:label class="checkbox-label" value="&from.label;"/>
  132.         <xul:label class="checkbox-label foundSource" xbl:inherits="xbl:text=source,infoURL,accesskey,crop"/>
  133.       </xul:hbox>
  134.     </content>
  135.     <implementation>
  136.       <property name="type" 
  137.                 onget="return this.getAttribute('type');"
  138.                 onset="this.setAttribute('type', val); return val;"/>
  139.       <property name="source" 
  140.                 onget="return this.getAttribute('source');"
  141.                 onset="this.setAttribute('source', val); return val;"/>
  142.       <property name="URL" 
  143.                 onget="return this.getAttribute('URL');"
  144.                 onset="this.setAttribute('URL', val); return val;"/>
  145.       <property name="hash" 
  146.                 onget="return this.getAttribute('hash');"
  147.                 onset="this.setAttribute('hash', val); return val;"/>
  148.       <property name="infoURL" 
  149.                 onget="return this.getAttribute('infoURL');"
  150.                 onset="this.setAttribute('infoURL', val); return val;"/>
  151.       <property name="internalName" 
  152.                 onget="return this.getAttribute('internalName');"
  153.                 onset="this.setAttribute('internalName', val); return val;"/>
  154.     </implementation>
  155.   </binding>
  156.  
  157.   <binding id="link" extends="chrome://global/content/bindings/text.xml#text-base">
  158.     <content>
  159.       <xul:label xbl:inherits="value=label,crop" class="linkLabel" flex="1"/>
  160.     </content>
  161.     <implementation>
  162.       <property name="href"
  163.                 onget="return this.getAttribute('href');"
  164.                 onset="this.setAttribute('href', val); return val;"/>
  165.     </implementation>
  166.     <handlers>
  167.       <handler event="keypress" keycode="VK_ENTER" action="this.click()" />
  168.       <handler event="keypress" keycode="VK_RETURN" action="this.click()" />
  169.       <handler event="click">
  170.       <![CDATA[
  171.         if (event.button != 0)
  172.           return;
  173.           
  174.         var uri = Components.classes["@mozilla.org/network/io-service;1"]
  175.                             .getService(Components.interfaces.nsIIOService)
  176.                             .newURI(this.getAttribute("href"), null, null);
  177.  
  178.         var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
  179.                                     .getService(Components.interfaces.nsIExternalProtocolService);
  180.         if (protocolSvc.isExposedProtocol(uri.scheme))
  181.           protocolSvc.loadUrl(uri);
  182.       ]]>
  183.       </handler>
  184.     </handlers>
  185.   </binding>
  186.  
  187. </bindings>
  188.  
  189.